import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SheetFormAttachmentVO, SheetFormAttachmentForm, SheetFormAttachmentQuery } from '@/api/sheet/sheetFormAttachment/types';

/**
 * 查询单附件列表
 * @param query
 * @returns {*}
 */

export const listSheetFormAttachment = (query?: SheetFormAttachmentQuery): AxiosPromise<SheetFormAttachmentVO[]> => {
  return request({
    url: '/system/sheetFormAttachment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询单附件详细
 * @param sheetFormAttachmentId
 */
export const getSheetFormAttachment = (sheetFormAttachmentId: string | number): AxiosPromise<SheetFormAttachmentVO> => {
  return request({
    url: '/system/sheetFormAttachment/' + sheetFormAttachmentId,
    method: 'get'
  });
};

/**
 * 新增单附件
 * @param data
 */
export const addSheetFormAttachment = (data: SheetFormAttachmentForm) => {
  return request({
    url: '/system/sheetFormAttachment',
    method: 'post',
    data: data
  });
};

/**
 * 修改单附件
 * @param data
 */
export const updateSheetFormAttachment = (data: SheetFormAttachmentForm) => {
  return request({
    url: '/system/sheetFormAttachment',
    method: 'put',
    data: data
  });
};

/**
 * 删除单附件
 * @param sheetFormAttachmentId
 */
export const delSheetFormAttachment = (sheetFormAttachmentId: string | number | Array<string | number>) => {
  return request({
    url: '/system/sheetFormAttachment/' + sheetFormAttachmentId,
    method: 'delete'
  });
};
